using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace Lds.Ward.PhotoDirectory.App
{
	public partial class BusyDialog : Form
	{
		public BusyDialog()
		{
			InitializeComponent();
		}

		public BusyDialog(Form owner) : this(owner, null, 0) { }

		public BusyDialog(Form owner, string status) : this(owner, status, 0) { }

		public BusyDialog(Form owner, string status, int workSize) : this()
		{
			this.owner = owner;
			owner.UseWaitCursor = true;
			StatusText = status;
			WorkSize = workSize;
			Show(owner);
			Application.DoEvents(); // give cursor a chance to change
			Disposed += new EventHandler(ImportProgressDialog_Disposed);
		}

		void ImportProgressDialog_Disposed(object sender, EventArgs e)
		{
			owner.UseWaitCursor = false;
		}

		private Form owner;

		public int WorkSize
		{
			get { return progressBar.Maximum; }
			set { progressBar.Maximum = value; }
		}

		public int Progress
		{
			get { return progressBar.Value; }
			set { progressBar.Value = value; }
		}

		public string StatusText
		{
			get { return statusLabel.Text; }
			set { statusLabel.Text = value; }
		}

	}
}